Home

Computer science

'

Jenna has been working on creating a DVD library where she can list all of the DVDs that she has. Some she bought herself, others were gifts from her mom, dad, sister, grandpa, and grandma. The root element for her library is dvdlibrary with one or more dvd elements. Each dvd has a title, description, year, company, favorite characters, favorite bonus features, and purchase information. Her characters elements each have one or more character elements. Her bonus elements each have one or more features. Her purchased elements each have price, location, and date. The dvd element has two attributes, bonus element has one attribute, and the purchased element has no attributes.

Jenna wishes to create an XSLT style sheet to use to display the DVD collection information attractively. She has already created a CSS style sheet for the page. Complete the following:

  1. Using your text editor, open the filedvdlibrary.txt.Review the contents to familiarize yourself with the structure of the XML file.
  2. Add a comment in the prolog with a description of the file, your name, date, and the filename.
  3. Save the file as dvdlibrary.xml.
  4. Add a processing instruction after the comment section that attaches the dvdlibrary.xsl style sheet to this XML document. Close the file, saving your changes.
  5. Using your text editor, open the file dvdlibrarytxt.xsl. Enter your name and the date in the comment section of the file, and save it as dvdlibrary.xsl.
  6. Go to the dvdlibrary.xsl file in your text editor and go down to the root template. Add the following commands to the template:

    <html>

<head>

<title>Jenna\'s DVD Collection</title>

<link href="dvdlibrarystyles.css"
rel="stylesheet" type="text/css" />

</head>

<body>

<header>

<h1>Jenna\'s DVD Collection</h1>

</header>

</body>

</html>

  1. Within the root template directly above the </body> tag, insert the following:

    <section>
    <h1>DVD List</h1>
    dvd template
    </section>

    where dvd template applies the template for the dvdlibrary/dvd path, sorted by the title element.
  2. Create a template for the dvd element to display information on each movie. Add the following HTML code to the template:

    <article>
    </article>
  3. Within the <article></article> tags, insert the following to display the title and list of characters for each DVD:

    <h1>title</h1>
    <h2>Featuring: [character] [character] …</h2>

    where title is the value of the title element and [character] [character] … is the list of characters in the movie. (Hint: Use the for-each instruction to go through each character element in the characters/character path.)
  4. Below the h2 heading, insert the following:

    <p>
          Bonus Features:
    <span>
    feature/feature/ …
    </span>
    </p>

    where feature/feature/ … is a list of the feature values within the bonus/feature path separated with the “/” symbol. (Hint: Use the for-each instruction with the bonus/feature path and display the value of the context node within the for-each element.)

  1. Below the closing </p> tag, insert the following table:

    <table>
    <tr>
    <th>Price</th>
    <th>Location</th>
    <th>Date</th>
    </tr>
    <tr>
    <td>price</td>
    <td>location</td>
  2. <td>date</td>
    </tr>
    </table>

    where pricelocation, and date are the values of the price, location, and date elements.
  3. Save your changes to the file.
  4. Generate a result document using either an XML editor or your Web browser. Verify that the layout and content of each item matches that shown in the figure below:

    ------------------------dvdlibrarystyles.css file-----------------------------------------

    /*
    New Perspectives on XML, 3rd Edition
    Tutorial 5
    Tutorial Project

    DVD Library Style Sheet
      

    Filename: libstyles.css
    Supporting Files: none

    */

    /* Default styles */

    * {
    margin: 0px;
    list-style: none;
    }

    header, section, article {
    display: block;
    }

    /* Body styles */
    body {
    background-color: white;
    font-family: Verdana, Geneva, sans-serif;
    margin: 10px auto;
    width: 920px;
    }

    header h1 {
    color: white;
    font-size: 2.8em;
    font-weight: normal;
    text-shadow: rgb(90, 127, 0) 0px 0px 25px;
    }

    header h2 {
    font-size: 1.5em;
    font-weight: normal;
    color: rgb(90, 127, 0);
    }

    section {
    margin-top: 25px;
    }

    section > h1 {
    font-weight: normal;
    font-size: 1.9em;
    }

    article {
    border: 1px solid black;
    margin: 10px 10px;
    padding: 10px;
    width: 400px;
    float: left;
    box-shadow: rgb(151, 151, 151) 8px 8px 15px;
    }

    article > h1, article > h2 {
    background-color: rgb(190, 235, 110);
    }

    article > h1 {
    font-size: 1em;
    font-weight: normal;
    padding: 10px 0px 0px 10px;
    }

    article > h2 {
    font-size: 0.7em;
    font-weight: normal;
    padding: 0px 0px 10px 10px;
    border-bottom: 1px solid black;
    }

    article > p {
    font-size: 0.7em;
    margin: 4px 0px 0px 0px;
    }

    article span {
    color: rgb(151,151, 151);
    }

    table {
    border-collapse: collapse;
    margin: 10px 0px 5px 0px;
    }

    td, th {
    border: 1px solid rgb(191, 191, 191);
    font-weight: normal;
    font-size: 0.7em;
    padding: 3px;
    text-align: center;
    }

    th {
    background-color: rgb(231, 231, 231);
    }
    ------------------------------dvdlibrary.txt file------------------------------------------------

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

    <dvdlibrary>
    <dvd isbn="1-4157-4399-0" from="mom">
    <title>Kung Fu Lizard</title>
    <description>Jo defends his training academy against the evil Mighty Moose, Benny.</description>
    <year>2011</year>
    <company>Cloud Nine Productions</company>
    <characters>
    <character>Jo, the Kung Fu Lizard</character>
    <character>Lisa, the Fighting Kricket</character>
    <character>Benny, the Evil Mangler Moose</character>
    </characters>
    <bonus num="2">
    <feature>Kung Fu Academy</feature>
    <feature>Cast Commentary</feature>
    </bonus>
    <purchased>
    <price>19.94</price>
    <location>Best DVDs in Town</location>
    <date>2012-10-03</date>
    </purchased>
    </dvd>

    <dvd isbn="1-5158-4399-0" from="mom">
    <title>Planet of the Ogres</title>
    <description>Bilbo had always dreamt he was from another planet. Now he finds out that he is. Join him as he meets his destiny to save his homeworld.</description>
    <year>2012</year>
    <company>MGM</company>
    <characters>
    <character>Bilbo, future leader of the Ogres</character>
    <character>Kilnary, leader of the invading Tigres</character>
    <character>Wicket, leader of the Morkian army</character>
    </characters>
    <bonus num="3">
    <feature>Making Of Featurette</feature>
    <feature>Theatre Trailers</feature>
    <feature>PC downloadable version</feature>
    </bonus>
    <purchased>
    <price>17.99</price>
    <location>Mallmart</location>
    <date>2013-10-06</date>
    </purchased>
    </dvd>

    <dvd isbn="1-9955-8745-0" from="mom">
    <title>Mountain King</title>
    <description>Freda is the daughter of the Mountain King. As the only heir, will she break with tradition and be the first Mountain Queen?</description>
    <year>2014</year>
    <company>Sunny Entertainment</company>
    <characters>
    <character>Freda, daughter of the Mountain King</character>
    <character>Toru, the Mountain King</character>
    <character>Ella, the Enchanted Advisor</character>
    <character>Bopo, the Monkey Bone Wizard</character>
    </characters>
    <bonus num="2">
    <feature>Cast Commentary</feature>
    <feature>Mountain King Music Video</feature>
    </bonus>
    <purchased>
    <price>14.99</price>
    <location>Movies For Everyone</location>
    <date>2015-11-07</date>
    </purchased>
    </dvd>

    </dvdlibrary>



'

Answer